<html><!-- InstanceBegin template="/Templates/_Admin_Template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>TCedit 测试用例编写工具 - 分配产品用户</title>
<!-- InstanceEndEditable -->
<link rel="shortcut icon" href="favicon.ico">
<link href="/css/common.css" rel="stylesheet" type="text/css">
<script src="/js/prototype.js"></script>
<script src="/js/common.js"></script>
<script>
function doAction(action){
  if (action == "create") {
    document.formData.action = "/product/assignProductUser.jspx?action=create&page=${page}";
  } else if (action == "update") {
    document.formData.action = "/product/assignProductUser.jspx?action=update&id=${productUser.id}&page=${page}";
  } else if (action == "delete") {
    if(confirm("是否确定要删除？")) {
      document.formData.action = "/product/assignProductUser.jspx?action=delete&id=${productUser.id}&page=${page}";
      document.formData.submit();
    }
  }
}
</script>
<script src="/js/md5.js"></script>
<script>
function checkForm(){
	if($F("userID")==""){
		alert("请选择用户名！");
		return false;
	}

	var choosed = false;
	var aInput = document.getElementsByTagName("input");
	for (var i = 0 ; i < aInput.length ; i++ ){
		if(aInput[i].name == "roleID" && aInput[i].checked == true){
			choosed = true;
			break;
		}
	}
	if(!choosed){
		alert("请选择产品角色！");
		return false;
	}

	return true;
}
function selectedItem(selectName, itemValue) {
  var objSelect=document.getElementById(selectName);
  for (var i=0; i < objSelect.options.length; i++) {
    if (objSelect.options[i].text.indexOf(itemValue) != -1) {
      objSelect.options[i].selected=true;
      break;
    }
  }
}
</script>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>

<body>
<!-- InstanceBeginEditable name="MainContent" -->
<table width="99%" align="center" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100%" valign="top">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td colspan="4" bgcolor="#dedeef"><b>分配产品用户</b></td>
        </tr>
        <tr>
          <td></td>
          <td>
            #if($error)
              <font color="#FF0000">$error</font>
            #end
          </td>
        </tr>
        <form action="" method="post" enctype="multipart/form-data" name="formData" id="formData" onSubmit="return checkForm()">
        <tr>
          <td width="15%" align="right">真实姓名：</td>
          <td width="85%"><input type="text" class="text" onKeyUp="selectedItem('userID', this.value)" /></td>
        </tr>
        <tr>
          <td></td>
          <td>
            <select size="10" style="width:40%;" name="userID" id="userID">
#foreach($a in $users)
              <option value ="$!{a.id}"
                #if($productUser.user && $a.id==$productUser.user.id)
                  selected
                #end
              >$!{a.displayName}</option>
#end
            </select>
          </td>
        </tr>
        <tr>
          <td><BR></td>
          <td></td>
        </tr>
        <tr>
          <td align="right">产品角色：</td>
          <td>（将鼠标停留在角色描述上可以显示该角色的角色名）</td>
        </tr>
        <tr>
          <td></td>
          <td>
            <table border="0">
            #foreach($role in $roles)
              <tr>
                <td>
                  <input input name="roleID" id="roleID" type="radio" value="$!{role.id}"
                    #if($productUser.user && $role.id==$productUser.role.id)
                      checked
                    #end
                  />
                  <a Title="$!{role.name}">$!{role.describing}</a></br>
                </td>
              </tr>
            #end
            </table>
          </td>
        </tr>
        <tr>
          <td></td>
          <td>
            #if($action=="" || $action=="create")
              <input name="SubmitCreate" type="submit" class="button" id="SubmitCreate" value="新增" onClick="doAction('create')" />
            #else
              #if (!($action=="delete"))
                <input name="SubmitUpdate" type="submit" class="button" id="SubmitUpdate" value="修改" onClick="doAction('update')" />
              #end
              <input name="SubmitDelete" type="button" class="button" id="SubmitDelete" value="删除" onClick="doAction('delete')" />
            #end
          </td>
          <td></td>
          <td></td>
        </tr>
        </form>
      </table>
    </td>
  </tr>
</table>
<!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd --></html>